home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / network / lattice / portlib.lzh / PORTLIB / STRSEP.C < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-28  |  277 b   |  25 lines

  1. /*
  2.  *    strsep() - TeSche
  3.  */
  4.  
  5. #include <stdio.h>
  6. #include <string.h>
  7.  
  8. char *strsep(char **s, char *sep)
  9. {
  10.     register char    *ptr, *this = *s;
  11.  
  12.     if (*s) {
  13.         if ((ptr = strpbrk(*s, sep))) {
  14.             *ptr++ = 0;
  15.             *s = ptr;
  16.         } else {
  17.             *s = NULL;
  18.         }
  19.  
  20.         return this;
  21.     }
  22.  
  23.     return NULL;
  24. }
  25.